<template>
  <div class="all-features">
    <TopBar></TopBar>
    <!-- <iframe id='linkedFrame'
            src="http://139.159.252.23:9067/mainPlay/content/mainText/allFeatures"
            frameborder="0"
            width="100%"
            height="auto"></iframe> -->
    <iframe id="testFrame"
            width="100%"
            height="auto"
            src="http://139.159.252.23:9067/mainPlay/content/mainText/allFeatures"></iframe>
  </div>
</template>

<script>
import Footer from "../components/commonComponent/footer.vue";
import TopBar from "../components/commonComponent/topBar.vue";

export default {
  data () {
    return {

    };
  },
  components: {
    Footer,
    TopBar
  },
  mounted () {
    var testFrame = document.getElementById('testFrame');
    testFrame.addEventListener('load', () => { testFrame.height = this.getHeight(testFrame.contentDocument) });
  },
  methods: {
    // reinitIframe () {
    //   let iframe = document.getElementById('linkedFrame')
    //   try {
    //     let bHeight = iframe.contentWindow.document.body.scrollHeight
    //     let dHeight = iframe.contentWindow.document.documentElement.scrollHeight
    //     let height = Math.max(bHeight, dHeight)
    //     iframe.height = height > 1000 ? height : 1000
    //   } catch (ex) {
    //     console.log(ex)
    //   }
    // },
    getHeight (doc) {
      var body = document.body, html = document.documentElement;
      var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
      console.log(height);
      return height;
    }
  },
  // mounted () {
  //   /**
  //     * iframe-宽高自适应显示   
  //     */
  //   const oIframe = document.getElementById('bdIframe');
  //   const deviceWidth = document.documentElement.clientWidth;
  //   const deviceHeight = document.documentElement.clientHeight;
  //   oIframe.style.width = (Number(deviceWidth) - 220) + 'px'; //数字是页面布局宽度差值
  //   oIframe.style.height = (Number(deviceHeight) - 120) + 'px'; //数字是页面布局高度差
  // },
};
</script>

<style scoped lang="less">
.all-features {
  overflow: hidden;
}
</style>
